from datetime import datetime
from django.utils import timezone as time
from django.db import models


class report(models.Model):
    id = models.IntegerField(primary_key=True)
    yingyeting = models.TextField(default="")
    areas = models.IntegerField(default=0)
    fugai = models.IntegerField(default=0)
    fugais = models.IntegerField(default=0)
    fugairate = models.FloatField(default=0)

    def __str__(self):
        return self.yingyeting

    class Meta:
        db_table = 'report1'  # 数据库表名


class result(models.Model):
    id = models.IntegerField(primary_key=True)
    area = models.TextField(default="")
    user_id = models.TextField(default="")
    user_name = models.TextField(default="")
    yingyeting = models.TextField(default="")
    gangwei = models.TextField(default="")
    xiaoqu_duty = models.IntegerField(default=0)
    xiaoqu_lous = models.IntegerField(default=0)
    xiaoqu_zhus = models.IntegerField(default=0)
    xiaoqu_xcs = models.IntegerField(default=0)
    xiaoqu_fxs = models.IntegerField(default=0)
    today_areas = models.IntegerField(default=0)
    today_lous = models.IntegerField(default=0)
    today_zhus = models.IntegerField(default=0)
    today_xcs = models.IntegerField(default=0)
    today_fxs = models.IntegerField(default=0)


    def __str__(self):
        return "result"

    class Meta:
        db_table = 'result'  # 数据库表名


class tmpobj(models.Model):
    data = models.TextField(default=0)

    def __str__(self):
        return self.title

    class Meta:
        db_table = 'tmp'  # 数据库表名


class xiaoqu(models.Model):
    _id = models.TextField(default="")
    _openid = models.TextField(default="")
    check_time = models.DateTimeField(default=time.now, )
    create_user = models.TextField(default="")
    finish_date = models.DateField(default=None)
    insert_time = models.DateTimeField(default=time.now, )
    fxs = models.IntegerField(default=0)
    lous = models.IntegerField(default=0)
    xcs = models.IntegerField(default=0)
    zhus = models.IntegerField(default=0)
    name = models.TextField(default="")
    user_name = models.TextField(default="")

    def __str__(self):
        return self.title

    class Meta:
        db_table = 'xiaoqu'  # 数据库表名


class duty(models.Model):
    user_id = models.TextField(default=0)
    area_id = models.TextField(default=0)

    def __str__(self):
        return self.title

    class Meta:
        db_table = 'duty'  # 数据库表名


# Create your models here.
class Counters(models.Model):
    id = models.AutoField
    count = models.IntegerField(default=0)
    createdAt = models.DateTimeField(default=time.now, )
    updatedAt = models.DateTimeField(default=time.now, )

    def __str__(self):
        return self.title

    class Meta:
        db_table = 'Counters'  # 数据库表名


class bind_user(models.Model):
    _id = models.TextField(default="")
    _openid = models.TextField(default="")
    gangwei = models.TextField(default="")
    yingyeting = models.TextField(default="")
    name = models.TextField(default="")

    def __str__(self):
        return self.title

    class Meta:
        db_table = 'bind_user'  # 数据库表名


class checkinfo(models.Model):
    _id = models.TextField(default="")
    _openid = models.TextField(default="")
    album = models.BooleanField(default=False)
    area_id = models.TextField(default="")
    area_name = models.TextField(default="")
    check_date = models.TextField(default="")
    insert_time = models.DateTimeField(default=time.now, )
    device = models.TextField(default="")
    fh_detail = models.TextField(default="")
    localip = models.TextField(default="")
    intnetip = models.TextField(default="")
    ipaddress = models.TextField(default="")
    fh_value = models.BooleanField(default=False)
    picimgs = models.TextField(default="")
    user_id = models.TextField(default="")
    user_name = models.TextField(default="")
    latitude = models.FloatField(default=0)
    longitude = models.FloatField(default=0)
    fxs = models.IntegerField(default=0)
    lous = models.IntegerField(default=0)
    xcs = models.IntegerField(default=0)
    zhus = models.IntegerField(default=0)

    def __str__(self):
        return self.title

    class Meta:
        db_table = 'checkinfo'  # 数据库表名
